package stringData

func SplitAny(s, step string) (result []any) {
	if step == "" {
		return []any{s}
	}
	nextIndex := 0
	index := 0
	for index < len(s) {

		if s[index] == step[0] {
			if index+len(step) <= len(s) && s[index:index+len(step)] == step {
				//fmt.Println("sub:", s[index:index+len(step)])
				if nextIndex < index {
					result = append(result, s[nextIndex:index])
				}

				index = index + len(step)
				nextIndex = index
				//fmt.Println("i=", index, "nextIndex:", index)
				continue
			}
		}
		//fmt.Println("last:", s[index:], index)
		if index+1 == len(s) && nextIndex <= index {
			result = append(result, s[nextIndex:])
			break
		}
		index++
	}
	return
}
